package com.demo.mybaits.dynamicproxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

import com.demo.mybaits.model.Websites;

public class ServiceInvocationHandler implements InvocationHandler {

	private Object target;
	
	public ServiceInvocationHandler(Object target) {
		this.target = target;
	}

	@Override
	public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
		System.out.println("执行方法前");
		Websites websites = new Websites();
		websites.setId(132);
		method.invoke(target, new Object[] {websites});
		System.out.println("执行方法后");
		return null;
	}

}
